package com.xxx.springboot.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * 1.WebSocket 配置类
 * https://mp.weixin.qq.com/s/xKxxDXDWrpmyE2rTMlT9HQ
 */
@Configuration
public class WebSocketConfig {

	/**
     * 给spring容器注入这个ServerEndpointExporter对象
     * 检测所有带有@serverEndpoint注解的bean并注册他们。
     *
     * @return
     */
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        System.out.println("注入 WebSocketConfig");
        return new ServerEndpointExporter();
    }
    
}
